package session08.homework;

import javax.swing.*;
import java.awt.*;

public class NumFrame extends JFrame {

    private Container contentP;
    private UpPanel upP;
    private MidPanel midP;
    private DownPanel downP;

    public UpPanel getUpP() {
        return upP;
    }

    public void setUpP(UpPanel upP) {
        this.upP = upP;
    }

    public MidPanel getMidP() {
        return midP;
    }

    public void setMidP(MidPanel midP) {
        this.midP = midP;
    }

    public DownPanel getDownP() {
        return downP;
    }

    public void setDownP(DownPanel downP) {
        this.downP = downP;
    }

    public NumFrame() {
        this.setTitle("猜数字");
        this.setSize(300, 450);
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
        this.setLocationRelativeTo(null);//传另一个容器就相对于另一个容器，传null就相对于屏幕
        this.setResizable(false);//设置窗体大小不可变

        this.addContent();

        this.setVisible(true);
    }

    private void addContent() {
        this.contentP = this.getContentPane();
        this.contentP.setLayout(null);

        this.upP = new UpPanel();
        this.upP.setBounds(0,0,300,130);
        this.midP = new MidPanel();
        this.midP.setBounds(0,130,300,150);
        this.downP = new DownPanel(this);
        this.downP.setBounds(0,250,300,150);

        this.contentP.add(this.upP);
        this.contentP.add(this.midP);
        this.contentP.add(this.downP);
    }
}
